package cn.stylefeng.guns.core.util;

import cn.stylefeng.guns.modular.system.entity.Coupon;
import org.apache.commons.lang3.RandomStringUtils;

import java.util.HashSet;
import java.util.Set;

public class RandomString {
  private final static String seed="ijkn67pq2345rstuQRSXvwMNmTxyUVW9zABCDEabcdOPYZ8efghFGHJKL";

  public static Set<Coupon> getSN(int length, int count){
    Set<Coupon> set = new HashSet();
    if (length<10){
      length=10;
    }
    while (set.size()<count){
      set.add(new Coupon(RandomStringUtils.random(length,seed)));
    }
    return set;
  }
}
